<% add_decidim_page_title(t("assemblies", scope: "decidim.admin.titles")) %>
<div class="card" id="assemblies">

  <% if parent_assembly && parent_assembly.self_and_ancestors.length %>
    <div class="item_show__header">
      <h1 class="item_show__header-title">
        <% parent_assembly.self_and_ancestors.each_with_index do |assembly, ix| %>
          <%= translated_attribute(assembly.title) %>
          <% unless ix == parent_assembly.self_and_ancestors.length - 1 %>
            &gt;
          <% end %>
        <% end if parent_assembly %>
      </h1>
    </div>
  <% end %>

  <%= admin_filter_selector %>

  <div class="table-stacked">
    <table class="table-list">
      <%= render partial: "assemblies_thead" %>
      <tbody>
        <%= render partial: "decidim/assemblies/admin/assemblies/assembly_row",
                   collection: @assemblies,
                   as: :assembly,
                   locals: { view: :index } %>
      </tbody>
    </table>
  </div>

  <% if allowed_to? :read, :assembly, trashable_deleted_resource: @assemblies %>
    <div class="mt-4">
      <%= link_to manage_trash_assemblies_path, class: "flex items-center  text-secondary" do %>
        <%= icon "delete-bin-2-line", class: "mr-2 fill-current text-secondary", role: "img" %>
        <%= t("actions.view_deleted_assemblies", scope: "decidim.admin") %>
        <span class="ml-2">
          <%= icon_with_tooltip("information-line", t("tooltips.deleted_assemblies_info", scope: "decidim.admin")) %>
        </span>
      <% end %>
    </div>
  <% end %>

  <%= decidim_paginate @assemblies %>
</div>

<%= append_javascript_pack_tag "decidim_assemblies_admin_list" %>
